//
//  UserAccoutTool.swift
//  weibo
//
//  Created by 叶子韬韬 on 2017/5/2.
//  Copyright © 2017年 叶子韬韬. All rights reserved.
//

import UIKit

class UserAccoutViewModel {
    
    static let shareInstance : UserAccoutViewModel = UserAccoutViewModel()

    var account : UserAccount?
    
    // MARK:- #注释>计算属性
    var accountPath: String {
        //获取沙盒路径
        var path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!
        path = path.appending("/account.plist")
        return path
    }
    
    var isLogin : Bool {
        if account != nil {
            return true
        }
        return false
    }
    
    init() {
        //读取信息
        account  = NSKeyedUnarchiver.unarchiveObject(withFile: accountPath) as? UserAccount

    }
    
    
}
